package com.wsclient;


import cn.edu.usts.service.serviceimpl.User;
import cn.edu.usts.service.serviceimpl.UserServiceImpl;
import cn.edu.usts.service.serviceimpl.UserServiceImplService;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import java.net.MalformedURLException;
import java.net.URL;

public class test {


    public static void main(String[] args) throws MalformedURLException {
            System.setProperty("javax.xml.bind.JAXBContext", "com.sun.xml.internal.bind.v2.ContextFactory");
            URL url = new URL("http://localhost:8081/ws/userService?wsdl");
            // 指定命名空间和服务名称
            QName qName = new QName("http://serviceImpl.service.usts.edu.cn/", "UserServiceImplService");
            Service service = Service.create(url, qName);
            UserServiceImplService port = service.getPort(UserServiceImplService.class);

            User user1 = port.getUserServiceImplPort().queryUser(1);

        System.out.println(user1.getName());


        }
    }
